package com.ruoyi.tzai.service.task;

import java.util.List;

/**
 * 并行处理器Service接口
 * 
 * @author tzai
 * @date 2025-11-12
 */
public interface IParallelProcessorService 
{
    /**
     * 并行翻译（跨模型）
     * 
     * @param taskId 任务ID
     * @param stepId 步骤ID
     * @param text 原文
     * @param sourceLang 源语言
     * @param modelIds 允许使用的模型ID列表，空=所有启用模型
     * @param parallelLevel 并行度
     * @return 翻译结果
     */
    String parallelTranslate(Long taskId, Long stepId, String text, 
                            String sourceLang, List<Long> modelIds, int parallelLevel);
    
    /**
     * 并行TTS生成（同引擎）
     * 
     * @param taskId 任务ID
     * @param stepId 步骤ID
     * @param sentences 句子列表
     * @param language 语言
     * @param ttsEngineId TTS引擎ID（必须指定）
     * @param voiceName 音色名称
     * @param parallelLevel 并行度
     * @return 音频结果列表
     */
    List<AudioResult> parallelTTS(Long taskId, Long stepId, List<String> sentences,
                                   String language, Long ttsEngineId, 
                                   String voiceName, int parallelLevel);
    
    /**
     * 分片结果
     */
    class ChunkResult {
        private int index;
        private String text;
        private Long keyId;
        private boolean success;
        private String error;
        
        public ChunkResult(int index, String text, Long keyId, boolean success, String error) {
            this.index = index;
            this.text = text;
            this.keyId = keyId;
            this.success = success;
            this.error = error;
        }
        
        public int getIndex() { return index; }
        public String getText() { return text; }
        public Long getKeyId() { return keyId; }
        public boolean isSuccess() { return success; }
        public String getError() { return error; }
    }
    
    /**
     * 音频结果
     */
    class AudioResult {
        private int index;
        private String audioUrl;
        private String ossKey;
        private double duration;
        private Long keyId;
        private boolean success;
        private String error;
        
        public AudioResult(int index, String audioUrl, String ossKey, 
                          double duration, Long keyId, boolean success, String error) {
            this.index = index;
            this.audioUrl = audioUrl;
            this.ossKey = ossKey;
            this.duration = duration;
            this.keyId = keyId;
            this.success = success;
            this.error = error;
        }
        
        public int getIndex() { return index; }
        public String getAudioUrl() { return audioUrl; }
        public String getOssKey() { return ossKey; }
        public double getDuration() { return duration; }
        public Long getKeyId() { return keyId; }
        public boolean isSuccess() { return success; }
        public String getError() { return error; }
    }
}

